home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / REFERENC / TPR / TPR9.TXT < prev   
Text File  |  1992-10-19  |  75KB  |  1,747 lines

  1.                                    Chapter 9
  2.                                     of the
  3.                             Turbo Pascal Reference
  4.  
  5.                           The Turbo Vision Reference
  6.                                   (continued)
  7.  
  8.  
  9. This chapter is part of the Turbo Pascal Reference electronic freeware book (C)
  10. Copyright 1992 by Ed Mitchell.  This freeware book contains supplementary
  11. material to Borland Pascal Developer's Guide, published by Que Corporation,
  12. 1992.  However, Que Corporation has no affiliation with nor responsibility for
  13. the content of this free book.  Please see Chapter 1 of the Turbo Pascal
  14. Reference for important information about your right to distribute and use this
  15. material freely.  If you find this material of use, I would appreciate your
  16. purchase of one my books, such as the Borland Pascal Developer's Guide or
  17. Secrets of the Borland C++ Masters, Sams Books, 1992.  Thank you.
  18.  
  19. For additional information on using Turbo Vision, including a detailed
  20. tutorial, please see Chapters 11 through 16 of the Borland Pascal Developer's
  21. Guide.
  22.  
  23.  
  24. TFrame object
  25. ------------------------------------------------------------ 
  26. Turbo Vision Hierarchy
  27.   TObject
  28.      TView
  29.        TFrame
  30.  
  31. Discussion
  32.      TFrameobjects, like many of the objects in Turbo Vision, are automatically
  33.      managed by Turbo Vision and you will rarely need to instantiate, let
  34.      alone, directly access any of its methods.  The TFrame object defines the
  35.      border or "frame" that wraps around each window and is automatically
  36.      created by TWindow.Init which calls TWindow.InitFrame.
  37.  
  38. Fields
  39.      None
  40.  
  41. Methods
  42. procedure Draw; virtual;
  43.      This method draws the frame, adding the owner's Title string, and the
  44.      appropriate icons such as the close box, the zoom icon and the resize
  45.      icon, as specified by the inherited TView.State flags.
  46. function GetPalette: PPalette; virtual;
  47.      Returns a pointer to the default palette CFrame.  In the unlikely event
  48.      that you need to change a TFrame's color, you need to override
  49.      TWindow.InitFrame to instantiate a new, TFrame-derived object with an
  50.      overridden GetPalette.  The overridden GetPalette then returns a pointer
  51.      to the modified color palette mapping.  You need to go through this
  52.      indirect approach of overriding both TWindow.InitFrame and creating a new
  53.      TFrame-type object because TFrame is normally used only internally to
  54.      Turbo Vision.  Hence, you must override the routine in TWindow that
  55.      actually instantiates the TFrame.  You can see an example of this type of
  56.      operation in the description of TBackground.
  57.  
  58. procedure HandleEvent(Event : TEvent);
  59.      Calls TView.HandleEvent for general event processing, and then processes
  60.      events for the TFrame icons.
  61.  
  62. constructor Init(var Bounds: TRect);
  63.      Creates a new TFrame object having the size and location specified by
  64.      Bounds.  This method is called by TWindow.InitFrame.
  65.      See:  TWindow.InitFrame
  66.  
  67. procedure SetState(AState: Word; Enable: Boolean; virtual;
  68.      TFrame.SetState passes its parameters to TView.SetState, and then checks
  69.      TView.State to see if either sfActive or sfDragging are set.  If these
  70.      bits are set, then TFrame.SetState calls TView.DrawView.
  71.  
  72.  
  73. TGroup object
  74. ------------------------------------------------------------ 
  75. Turbo Vision Hierarchy
  76.   TObject
  77.      TView
  78.        TGroup
  79.           TWindow
  80.             TDialog
  81.           TDeskTop
  82.           TProgram
  83.  
  84. Discussion
  85.      The TGroup object manages groups of objects, all of which are descended
  86.      from TView.  In effect, TGroup keeps track of a group of subviews, such as
  87.      multiple windows on the desktop, or all of the controls within a dialog. 
  88.      TGroup provides the functionality to manipulate the grouped views as if
  89.      they were a single view, although TGroup itself, surprisingly, is an
  90.      invisible view.  That's because each of the subviews contained within a
  91.      group defines the group itself.  For example, a TDialog contains a window,
  92.      a frame, a dialog interior and a collection of controls such as input
  93.      lines, checkboxes and buttons.  The TDialog object is the manager of these
  94.      dialog box components and is actually invisible.  WhenTDialog.Draw is
  95.      called to draw itself on the screen, it doesn't actually draw anything; 
  96.      instead, TDialog.Draw calls each of the subview's Draw methods (the
  97.      window, the frame, the buttons and so on).
  98.  
  99. Commonly Used Features
  100.        For most applications you will use only a few of the methods provided by
  101.      TGroup, including the Init constructor (via the subview's inherited Init
  102.      methods), ExecView to execute a modal dialog box, Insert to add a subview
  103.      to the group, and GetData and SetData to read and write the data fields of
  104.      the owned views (particularly for dialogs).   TGroup is an internal object
  105.      used to support other Turbo Vision objects (such as TWindow or TDialog),
  106.      and the remaining methods are used to implement their specific
  107.      functionality.  It is unlikely that you will need to instantiate a TGroup
  108.      directly.
  109. Example
  110.      See TApplication, TDeskTop, TDialog, TWindow
  111.  
  112. Fields
  113. Buffer: PVideoBuf; { Read only }
  114.      When caching of views is in effect, the contents of the group of views is
  115.      stored in a temporary cache buffer to speed up screen redrawing.  Buffer
  116.      points to the memory buffer used for caching, or is nil if no cache buffer
  117.      has been defined.
  118.      See GetBufMem, TGroup.Draw, TGroup.Lock, TGroup.Unlock
  119.  
  120. Current: PView; { Read only }
  121.      Is a pointer to the currently selected view (the view whose Select method
  122.      has been called). 
  123.      See:  TView.Select, Chapters 16 and 18.
  124.  
  125. Last: PView; { Read only }
  126.      Last is a pointer to the subview that is on the bottom of the Z-ordered
  127.      list of views.  Each view contains a TView.Next pointer that points to the
  128.      next view in the list.
  129.  
  130. Phase: (phFocused, phPreProcess, phPostProcess); { Read only }
  131.      Subviews can examine this field to determine at which phase in the event
  132.      processing their HandleEvent method was called.  See Chapter 13, "More
  133.      Turbo Vision Features" in the Borland Pascal Developer's Guide for a more
  134.      in depth discussion of phased event processing.
  135.  
  136. Methods
  137. procedure ChangeBounds(var Bounds: TRect); virtual;
  138. Override: Never
  139.      A group is resized or moved by calling ChangeBounds, which, in turn, calls
  140.      TView.CalcBounds to recalculate new boundaries for its subviews, and then
  141.      ChangeBounds to reposition the subviews.  These calls are made for every
  142.      subview in the group.
  143.  
  144. function DataSize: Word; virtual;
  145.      Calls each subview's DataSize method and creates a total data size value
  146.      for the entire group.  This function is normally used in conjunction with
  147.      GetData and SetData for retrieiving specific field values.
  148.  
  149. procedure Delete(P: PView);
  150.      Use Delete to remove a previously inserted view from a group.  For
  151.      example, if you have inserted a view, like this,
  152.             Insert(DirWindow);
  153.      you remove the subview by calling,
  154.             Delete(DirWindow);
  155.  
  156. destructor Done; virtual;
  157.      Call Done to dispose of the group and its contents.  Done first hides the
  158.      group and then calls each view's Done destructor, and finally disposes of
  159.      itself.
  160.  
  161. procedure Draw; virtual;
  162.       If  Buffer is nil, then TGroup.Draw calls each subview's Draw method.  If
  163.       Buffer is not nil, then Draw calls TView.WriteBuf to copy the cached view
  164.      image to the screen. 
  165.      See:  TGroup.Buffer
  166.  
  167. procedure EndModal(Command: Word)(; virtual;
  168. Override: Never
  169.      When the currently active dialog, for instance, that has been placed on
  170.      the screen with the TGroup.ExecView method, it is the current modal view. 
  171.      A call to this procedure terminates the modal nature of the view and
  172.      passes the Command value to ExecView, which in turn, returns Command to
  173.      the caller.  If a group is not currently a modal view, TGroup.EndModal
  174.      calls TView.EndModal which has approximately the same result, causing
  175.      ExecView to return Command to its caller.
  176.      See:  TView.EndModal
  177.  
  178. procedure EventError(var Event: TEvent); virtual;
  179.      If TGroup.Execute encounters an event that it cannot handle, it first
  180.      calls TGroup.EventError, which attempts to call its owner's EventError
  181.      method.  You can override this function to intercept errors, if needed.
  182.  
  183. function ExecView(P: PView): Word;
  184.      Besides Init, Done and Insert, this is one of the most commonly used
  185.      methods in a TGroup object.  Call ExecView to display a modal view, such
  186.      as a dialog box, on the screen.  When a modal view is on the screen, all
  187.      events are handled by the modal view.  You can not, for instance, make
  188.      menu selections or press short cut keys to activate non-dialog box
  189.      functions.  You must first terminate the modal dialog before resuming
  190.      regular program operation.  ExecView returns the command code that caused
  191.      the view to complete.  This might be cmOk, cmCancel or some other code
  192.      that you have defined as part of the dialog definition.
  193.      See:  TGroup.Insert, TGroup.Delete, Chapter 12
  194.  
  195. function Execute: Word; virtual;
  196.      Execute is the TGroup's main event processing loop, fetching events and
  197.      then calling HandleEvent to process each event.  The loop is terminated
  198.      when a view calls EndModal.  Execute returns the command code that caused
  199.      the termination, and that is passed to ExecView for return to the caller.
  200.      See:  TGroup.EndModal, TGroup.HandleEvent
  201.  
  202. function First: PView;
  203.      Returns a pointer to the subview within the group that is currently "on
  204.      top" or closest to the screen.  If, for some reason, this is called when
  205.      the group has no subviews, First returns nil.
  206.  
  207. function FirstThat(Test: Pointer): PView;
  208.      Test is a pointer to a far local function having one Pointer parameter and
  209.      returning either True or False.  This iterator function operates
  210.      identically to the TCollection.FirstThat iterator, except that
  211.      TGroup.FirstThat scans through the list of subviews within the group, in
  212.      Z-order (see Chapter 13, "More Turbo Vision Features".)
  213.      See:  Chapter 14, "Collections", TCollection.FirstThat
  214.  
  215. procedure ForEach(Action: Pointer);
  216.      Action is a pointer to a far local procedure having one Pointer (or PView)
  217.      parameter.  ForEach scans through the subviews in Z-order, and for each
  218.      subview it calls the Action procedure with a pointer to the subview. 
  219.      TGroup.ForEach operates similarly to TCollection.ForEach, except that you
  220.      should normally call TGroup.Lock prior to calling TGroup.ForEach, and
  221.      TGroup.Unlock after calling ForEach.  This is particularly important when
  222.      the ForEach iterator is used such that each subview is redrawn on the
  223.      screen and TGroup is using a cache Buffer.  Lock causes subsequent screen
  224.      writes to go only to the cache Buffer, and Unlock then copies the entire
  225.      Buffer to the screen.  If you do not use Lock/Unlock, each of the subviews
  226.      will repaint on the screen individually, causing a potentially annoying
  227.      visual effect.
  228.      See:  Chapter 14, "Collections", TGroup.Buffer, TGroup.Lock, TGroup.Unlock
  229.  
  230. procedure GetData(var Rec); virtual;
  231.      Calls each subview's GetData procedure in reverse Z-order, copy each
  232.      subview's data to the Rec variable.  After calling each subview's GetData
  233.      procedure, GetData adds the subview's DataSize value to Rec so that Rec
  234.      now points past the data it just copied, making it ready to read the next
  235.      subview's data.
  236.      See:  TView.DataSize, TGroup.SetData
  237.  
  238. function GetHelpCtx: Word; virtual;
  239.      Calls the currently Selected subview's GetHelpCtx to return the subview's
  240.      context sensitive help index.  If the subview doesn't have any context
  241.      sensitive help, then GetHelpCtx returns the value of the help context for
  242.      the entire TGroup.
  243.  
  244. procedure GetSubViewPtr(var S: TStream; var P);
  245.      This procedure is called from within TGroup.Load to read a subview pointer
  246.      P from stream S.
  247.      See:  TGroup.Load, TGroup.PutSubViewPtr, TGroup.Store
  248.  
  249. procedure HandleEvent(Event: TEvent); virtual;
  250.      The TGroup.HandleEvent method passes most events onto the appropriate
  251.      subview's HandleEvent method according to whether the event is a focused
  252.      event, positional event or broadcast event.  See Chapters 12 and 13 in the
  253.      Borland Pascal Developer's Guide for a detailed description of event
  254.      processing.
  255.  
  256. constructor Init(var Bounds: TRect);
  257.      TGroup's Init method calls TView.Init, and sets the TView.Options variable
  258.      to ofSelectable and ofBuffered.  The latter option enables cache buffering
  259.      of the view's Draw output, if sufficient memory is available.  TView's
  260.      EventMask field is set to $FFFF which causes this view (or group) to
  261.      respond to all classes of events.
  262.  
  263. procedure Insert(P: PView);
  264.      Use Insert to place a non-modal view into the group.  For example, Insert
  265.      is used to place windows onto the TDeskTop group object, as well as all of
  266.      the individual controls within a dialog object.
  267.      See:  TGroup.Delete, TGroup.ExecView, TGroup.InsertBefore
  268.  
  269. procedure InsertBefore(P, Target: PView);
  270.      InsertBefore enables you to insert a view at any location within an
  271.      existing group.  The view P becomes inserted before (in Z-Order) the view
  272.      specified by Target.  If Target is nil, then P is inserted at the very
  273.      back of the view, furthest from the screen.
  274.  
  275. constructor Load(var S: TStream);
  276.      Load creates a new TGroup object and reads each subview from stream S.
  277.  
  278. procedure Lock;
  279.      When using the cache Buffer to speed up screen output, setting Lock
  280.      prevents the Buffer contents from being written to the screen.  This way,
  281.      multiple items or views can be written to the Buffer without causing
  282.      annoying flicker, and then by calling Unlock, the entire Buffer is copied
  283.      to the screen in one operation.  Lock operates by incrementing a lock
  284.      counter each time that it is called.  Unlock decrements the counter and
  285.      once the counter reaches zero, copies the Buffer to the screen.
  286.      Important:  Lock and Unlock must always be called in matched pairs to
  287.      avoid leaving the Buffer in a locked state.  If that happens, no output
  288.      will be sent to the screen.
  289.      See:  GetBufMem, TGroup.ForEach, TGroup.Unlock
  290.  
  291. procedure PutSubViewPtr(var S: TStream,; P: PView);
  292.      This method is used in conjunction with the TGroup.Store method to write a
  293.      subview pointer to stream S.
  294.      See:    TGroup.GetSubViewPtr, TGroup.Load, TGroup.Store
  295.  
  296. procedure Redraw;
  297.      Redraw forces an actual screen draw to occur, rather than merely copying
  298.      from the cache Buffer.  Otherwise, Redraw is the same as TGroup.Draw.
  299.  
  300.  
  301. procedure SelectNext(Forwards: Boolean);
  302.      SelectNext complements the TView.Select method for making a view the
  303.      focused view.   If  Forwards is True, then the next subview in Z-Order
  304.      from the currently selected view becomes the focused view.  If Forwards is
  305.      False, then SelectNext moves to the previous subview.
  306.  
  307. procedure SetData(var Rec); virtual;
  308.      SetData is used in conjunction with GetData for accessing the data in the
  309.      group.  SetData calls each subview's SetData method, copying data from Rec
  310.      to the subviews.
  311.  
  312. procedure SetState(AState: Word; Enable: Boolean); virtual;
  313.      TGroup.SetState sets or clears the bits in each subview's State field, to
  314.      accomodate setting focused, active, exposed or dragging bits within State.
  315.      See:  TView.SetState, sfXXXX constants
  316.  
  317. procedure Store(var S: TStream);
  318.      Outputs all the TGroup and all of its subviews to stream S.
  319.  
  320. procedure Unlock;
  321.      Unlocks a previously locked cache Buffer and copies the contents of the
  322.      Buffer to the screen.
  323.      See:  TGroup.Locked
  324.  
  325. function Valid(Command: Word): Boolean; virtual;
  326.      If all of the subview's Valid functions return True, then TGroup.Valid
  327.      returns True, otherwise TGroup.Valid returns False.  Since Valid is called
  328.      when the Execute procedure is going to exit, a subview can retain control
  329.      and prohbit the group from terminating by setting its Valid function to
  330.      return False.
  331.      See:  TGroup.Execute, TView.Valid
  332.  
  333.  
  334. THistory object
  335. ------------------------------------------------------------ 
  336. Turbo Vision Hierarchy
  337.   TObject
  338.      TView
  339.        THistory
  340.  
  341. Discussion
  342.      THistory implements the history windows that display a down arrow icon on
  343.      the right hand side of dialog input fields.  Using THistory, a history of
  344.      previously entered data is retained for future reference.  Each time you
  345.      enter a new value into an input field that is linked to a THistory object,
  346.      the old value is stored away in a THistory list.  Later, when you return
  347.      to the input field, you can press down arrow or click on the down arrow
  348.      icon to open a small list viewer showing your previous entries.  This
  349.      feature is especially useful in applications such as the Turbo Pascal IDE,
  350.      where you tend to refer back to files you have opened previously.  Hence,
  351.      the open file dialog contains a history of the files you have recently
  352.      opened.
  353.             The THistory object is surprisingly easy to use considering the
  354.      functions that is provides.  All that needs to be done is to create the
  355.      object using its Init constructor and insert it into the dialog.  Data is
  356.      then automatically copied from the TInputLine field to the THistory and
  357.      back again, as appropriate.
  358.             It is not recommended that you attempt to override any of the
  359.      defined methods, except perhaps THistory.GetPalette.  If you must override
  360.      any of the methods, you are strongly encouraged to view the Turbo Vision
  361.      source, available as a separate product from Borland.
  362.  
  363. Example
  364.      This short example demonstrates the use of the THistory object in a
  365.      dialog, by modifying the TShell.ConfigureData procedure of TVSHELL8 (and
  366.      example proggram shown in the Borland Pascal Developer's Guide), so that
  367.      the EditorName field now contains a THistory list.  The variable AnHistory
  368.      is declared as a PHistory pointer.  In the original procedure, EditorName
  369.      is declared as a PView so it is recast to a PInputLine for passing to the
  370.      THistory.Init constructor.  To use THistory, define a Bounds rectangle for
  371.      the THistory icon, typically immediately to the right of the input field,
  372.      call the Init constructor, passing to it the location, a pointer to the
  373.      linked input field, and a numeric value.  The numeric value (from 0 to
  374.      255) uniquely defines this THistory list so that you could gain access to
  375.      it from other fields.  That means, more than one input field can reference
  376.      the same history list by always referencing the same history list number. 
  377.      Alternatively, you can use different history identification numbers for
  378.      each input field and have as many separate history lists as your
  379.      application requires.
  380.  
  381.   { Editor name }
  382.   Bounds.Assign (18, 2, 50, 3);
  383.   EditorName := New( PInputLine, Init(Bounds, ConfigNameSize) );
  384.   Insert(EditorName);
  385.  
  386.   { Define the location for the THistory down arrow icon }
  387.   Bounds.Assign(50, 2, 52, 3);
  388.   AnHistory := New(PHistory, 
  389.      Init(Bounds, PInputLine(EditorName), 1 ));
  390.   Insert(AnHistory);
  391.  
  392.   Bounds.Assign (2, 2, 15, 3);
  393.   Insert( New (PLabel,
  394.             Init(Bounds, '~E~ditor name:',
  395.             EditorName )));
  396.  
  397. Fields
  398. HistoryId: Word; { Read only }
  399.      Contains the history list number assigned as the third parameter to the
  400.      Init constructor.
  401.  
  402. Link: PInputLine; { Read only }
  403.      Points to the input line field's TInputLine object that is associated with
  404.      this history list.
  405.  
  406. Methods
  407. procedure Draw; virtual;
  408.      Displays the icon representing the THistory object, at the location
  409.      determined by the Bounds parameter to Init.
  410.  
  411. function GetPalette: PPalette; virtual;
  412.      Returns a pointer to the CHistory color palette, which is intended for
  413.      mapping onto the CDialog color palette.
  414.  
  415. constructor Init(var Bounds: TRect; ALink: PInputLine; AHistoryId: Word);]
  416.      Creates the THistory object, defining its location at Bounds, and linking
  417.      to the ALink input field.  AHistoryID is a number assigned by you to
  418.      uniquely identify this particular history list.   If you want, you can
  419.      initialize other THistory objects that are linked to other input fields
  420.      using the same AHistory number.  When the input fields have the same
  421.      AHistory number, they will all share the same history list.
  422.  
  423. constructor Load(var S: TStream);
  424.      Creates and reads a THistory object from stream S.
  425.  
  426. procedure Store(var S: TStream);
  427.      Writes this THistory object to stream S.
  428.  
  429.  
  430. THistoryViewer object
  431. ------------------------------------------------------------ 
  432. Turbo Vision Hierarchy
  433.   TObject
  434.      TView
  435.        TListViewer
  436.           THistoryViewer
  437.  
  438. Discussion
  439.      THistoryViewer manages the history list viewer that is displayed and owned
  440.      by THistory.  Normally, you will access the THistory object when you wish
  441.      to use history lists in your applications, and will unlikely have any need
  442.      to directly use THistoryViewer.
  443.  
  444. Fields
  445. HistoryId: Word; { Read only }
  446.      This contains the history identification number (see THistory) selecting
  447.      which history list is to be displayed in the list box managed by
  448.      THistoryViewer.
  449.  
  450. Methods
  451. function GetPalette: PPalette; virtual;
  452.      Returns a pointer to CHistoryViewer.
  453.  
  454. function GetText (Item: Integer; MaxLen: Integer): String; virtual;
  455.      GetText is the overridden TListViewer function, implemented here to return
  456.      the specific history list string indexed by Item, such that the returned
  457.      string is less than or equal to MaxLen in size.
  458.      See TListViewer.GetText
  459.  
  460. procedure HandleEvent(var Event: TEvent); virtual;
  461.      HandleEvent processes mouse double clicks and the Enter key for selecting
  462.      a file from the list box, and pressing the Esc key in order to cancel the
  463.      list box.
  464.  
  465. function HistoryWidth: Integer;
  466.      Determines the longest string in the history list.
  467.  
  468. constructor Init
  469.      (var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar;
  470.        AHistoryId: Word);
  471.      Calls TListViewer.Init to create a single column listbox with the
  472.      specified scroll bars, and links it to the THistory specified by AHistory.
  473.      Basically, when the THistory object is made active by selecting its icon
  474.      or pressing the down arrow key, THistory creates a THistoryWindow object
  475.      by calling InitHistoryWindow, and the THistoryWindow object, in turn,
  476.      creates this TListViewer object to display the history list and manage the
  477.      selections.
  478.  
  479. THistoryWindow object
  480. ------------------------------------------------------------ 
  481. Turbo Vision Hierarchy
  482.   TObject
  483.      TView
  484.        TGroup
  485.           TWindow
  486.             THistoryWindow
  487.  
  488. Discussion
  489.      When the THistory history list icon is selected, the THistory object
  490.      creates a TWindow object in which to insert the THistoryViewer. 
  491.      Therefore,the THistoryWindow is primarily useful to the implementation of
  492.      THistory and is not likely to be used directly by your programs.  See the
  493.      THistory object for an example use of history lists.
  494.  
  495. Fields
  496. Viewer: PListViewer;
  497.      Contains a pointer to the THistoryViewer list box that is created by this
  498.      object.
  499.  
  500. Methods
  501. function GetPalette: PPalette; virtual;
  502.      Returns a pointer to CHistoryWindow, which is designed to map onto a
  503.      dialog palette.
  504.  
  505. function GetSelection: String; virtual;
  506.      Determines which list box item in the THistoryViewer has the focus, and
  507.      returns that specific string.
  508.  
  509. constructor Init(var Bounds: TRect; HistoryId: Word);
  510.      Creates the THistoryWindow by calling TWindow.Init with appropriate
  511.      parameters, and then calls InitViewer.
  512.  
  513. procedure InitViewer(HistoryId: Word); virtual;
  514.      This is the routine that creates the THistoryViewer list box.
  515.  
  516.  
  517. TInputLine object
  518. ------------------------------------------------------------ 
  519. Turbo Vision Hierarchy
  520.   TObject
  521.      TView
  522.        TInputLine
  523.  
  524. Discussion
  525.      Use TInputLine as an edit field in dialog boxes when you need to have the
  526.      user type in information such as a filename or other text.  TinputLine is
  527.      a powerful single line editor, providing horizontal scrolling, line
  528.      editing, text selection and block deletion.  If the size of the input line
  529.      field is less than the maximum permitted length of the input, then
  530.      TInputLine will automatically provide left and right scrolling.
  531.  
  532. Commonly Used Methods and Fields
  533.             When TInputLine is inserted into a dialog, you will generally use
  534.      only TInputLine.Init to create the input field and will not likely have
  535.      use for any of the other methods or fields.  The TInputLine will become
  536.      active when it receives the focus and will automatically process its input
  537.      via its HandleEvent method.
  538.             TInputLine processes string input however you could override
  539.      several of its methods in order to process other types of data.  For
  540.      instance, to handle numeric input, you would create a new
  541.      TInputLine-derived object and override TInputLine.Valid to check for valid
  542.      numeric entries, and modify GetData to convert the entered string into a
  543.      numeric representation for processing.  You would also need to modify
  544.      SetData, and if you intend to use the object with streams, you'd need to
  545.      create new versions of Load and Store.
  546.  
  547. Example
  548.      This example shows instantiating a TInputLine object having a maximum
  549.      input length of 40 character, and places within the rectangle defined by
  550.      (3, 3, 44, 4).  The TInputLine object is then inserted into the dialog
  551.      group, and a TLabel is attached as a prompt.  (See also TLabel).  At the
  552.      completion of the dialog setup, the dialog will be displayed for editing
  553.      with  Control := DeskTop^.ExecView( Dialog );  Be sure to look at the
  554.      examples in the TVSHELL program described in Chapters 11-12 of the Borland
  555.      Pascal Developer's Guide:
  556.  
  557.   with  Dialog^  do
  558.   begin
  559.   ...  
  560.      { Add the Rename from this filename item }
  561.      Bounds.Assign (3, 3, 44, 4);
  562.      OldFileName := New( PInputLine, Init(Bounds, 40) );
  563.      Insert(OldFileName);
  564.      Bounds.Assign (2, 2, 44, 3);
  565.      Insert( New (PLabel, Init(Bounds, 'Rename this file:',
  566.                    OldFileName )));
  567.   ...
  568.   end; { with Dialog }
  569.  
  570.  
  571. Fields
  572. CurPos: Integer; { Read/Write }
  573.      This field is used internally to keep track of the cursor's location
  574.      within the input field.
  575.  
  576. Data: PString; { Read/Write }
  577.      Contains the pointer to the string that is being edited by the TInputLine.
  578.  
  579. FirstPos: Integer;
  580.      When horizontal scrolling is being used to display portions of the line
  581.      that do not fit within the specified bounds of the TInputLine, FirstPos
  582.      contains the index of the first byte that appears at the left of the
  583.      field.
  584.  
  585. MaxLen: Integer;
  586.      MaxLen contains the maximum number of characters for the line length, as
  587.      specified in the TInputLine.Init method.
  588.  
  589. Methods
  590. destructor Done; virtual;
  591.      Disposes of the memory used by TInputLine and disposes of the object.
  592.  
  593. function DataSize: Word; virtual;
  594.      GetData and SetData call DataSize to determine how much space needs to be
  595.      reserved for the data returned by TInputLine.  Normally this is equal to
  596.      MaxLen + 1, which is the maximum number of characters that can be entered,
  597.      plus the length byte.
  598.      See:  TInputLine.GetData, TInputLine.SetData
  599.  
  600. procedure Draw; virtual;
  601.      Draw takes care of displaying the input line text on the screen, adding
  602.      arrows when horizontal scrolling is in effect.
  603.  
  604. procedure GetData(var Rec); virtual;
  605.      Copies the Data^ text string to Rec.
  606.      See:  TInputLine.DataSize, TInputLine.SetData
  607.  
  608. function GetPalette: PPalette; virtual;
  609.      Returns a pointer to the CInputLine color palette.  If you desire to use a
  610.      different color mapping, you should derive a new object from TInputLine
  611.      and override GetPalette as per the instructions in Chapter 13, "More Turbo
  612.      Vision Features", of the Borland Pascal Developer's Guide.
  613.  
  614. procedure HandleEvent(var Event: TEvent); virtual;
  615.      When the input line is the focused event, TInputLine.HandleEvent process
  616.      the mouse and editing keystroke events, including entering and selecting
  617.      text, horizontal scrolling and so on.
  618.  
  619. constructor Init( var Bounds: TRect; AMaxLen: Integer);
  620.      Use TInputLine.Init to create a new TInputLine object located at the
  621.      position specified by Bounds (which specifies the length of the visible
  622.      data entry field) and AMaxLen (which specifies the maximum length that the
  623.      entered string can become).
  624.      Bounds should describe a one line input field; if you specify a multi-line
  625.      rectangle, TInputLine will not behave correctly.
  626.  
  627. constructor Load(var S: TStream);
  628.      Creates and reads a TInputLine object from stream S.
  629.  
  630. procedure SelectAll(Enable: Boolean);
  631.      If Enable is True, SelectAll block selects the entire data input line and
  632.      resets all the internal pointers (such as CurPos cursor location) to the
  633.      beginning of the string.  If Enable is False, all selection is turned off.
  634.      In both cases, the resultant input field is displayed on the screen by
  635.      calling the inherited TView.DrawView.
  636.  
  637. procedure SetData(var Rec); virtual;
  638.      Copies the string value in Rec to Data^ and calls SelectAll.
  639.      See:  TInputLine.SelectAll
  640.  
  641. procedure SetState(AState: Word; Enable: Boolean); virtual;
  642.      Calls TView.SetState (See TView.SetState for more information) and
  643.      performs additional processing for TInputLine.
  644.  
  645. procedure Store(var S: TStream);
  646.      Writes the TInputLine object to stream S.
  647.  
  648.  
  649. TItemList type
  650. ------------------------------------------------------------ 
  651. Declaration:       
  652.      TItemList = array[0..MaxCollectionSize-1] of Pointer;
  653.  
  654. Unit:     Objects
  655.  
  656. Purpose:
  657.      This is an internal object type used for maintaining an array of pointers
  658.      in TCollection objects.
  659.  
  660.  
  661. TLabel object
  662. ------------------------------------------------------------
  663. Turbo Vision Hierarchy:
  664.   TObject
  665.      TView
  666.        TStaticText
  667.           TLabel
  668.  
  669. Discussion
  670.      TLabel objects are similar to TStaticText in that they are typically used
  671.      to display a prompt line for dialog box controls such as an input field or
  672.      a group of radio buttons.  TLabel objects differ from TStaticText only in
  673.      that they are explicitly linked to the control such that if you click with
  674.      the mouse to select the TLabel object you actually select the attached
  675.      control.  Using this feature, you can use keyboard Alt-letter shortcut
  676.      keys to reach input fields and other controls in a dialog box.
  677.  
  678. Example
  679.      { Create an input line field 40 spaces wide }
  680.      Bounds.Assign(3, 3, 44, 4);
  681.      OldFileName := New( PInputLine, Init( Bounds, 40) );
  682.      Insert( OldFileName );
  683.      { Create a prompt label for the input field and link to the
  684.        OldFileName inputline field }
  685.      Bounds.Assign( 2, 2, 44, 3);
  686.      Insert( New( PLabel, Init( Bounds, 'Rename this file:',
  687.        OldFileName )));
  688.  
  689. Fields
  690. Link : PView  { Read Only }
  691.      When a TLabel object is linked to a control, such as an input line, this
  692.      field contains a pointer to that control.
  693.  
  694. Light: Boolean; { Read Only }
  695.  
  696. Methods
  697. procedure Draw; virtual;
  698. Override:  NEVER
  699.      Draws the TLabel object using the color palette pointed to by GetPalette.
  700.  
  701. constructor Init (var Bounds: TRect; AText; String; ALink: PView);
  702.      The Init constructor creates a new TLabel object with the size and
  703.      location specified in Bounds, and assigns to the label the text specified
  704.      in AText.  The last parameter specifies a pointer to the control that is
  705.      associated with this label.
  706.  
  707. function GetPalette: PPalette; virtual;
  708. Override:  As needed to change colors.
  709.      Returns a pointer to the CLabel color palette.  To change the colors of
  710.      the TLabel object, override this function to return a pointer to a
  711.      different color palette.  The CLabel color palette is defined to properly
  712.      map onto a dialog's color palette.  If, for some reason, you are creating
  713.      a label to be placed on top of some other type of object, you will almost
  714.      certainly need to override this function.
  715.      See:  Chapter 13, "More Turbo Vision Features".
  716.  
  717. procedure HandleEvent( var Event: TEvent ); virtual;
  718. Override:  Never
  719.      HandleEvent performs the usual event processing by calling
  720.      TStaticText.HandleEvent to do most of the work.  However,
  721.      TLabel.HandleEvent intercepts certain mouse down and keyboard shortcut
  722.      keys in order to select attached controls.
  723.  
  724. constructor Load( var S: TStream );
  725.      Loads a TLabel object from stream S.
  726.      See:  Chapter 15, "Streams"
  727.  
  728. procedure Store( var S: TStream );
  729.      Stores this view on to stream S.
  730.      See:  Chapter 15, "Streams"
  731.  
  732.  
  733. TListBox object
  734. ------------------------------------------------------------ 
  735. Turbo Vision Hierarchy:
  736.    TObject
  737.      TView
  738.        TListViewer
  739.           TListBox
  740.  
  741. Discussion
  742.             Use TListBox  to implement list boxes containing collections of
  743.      strings.  For example, a dialog box to open a file typically contains a
  744.      list of filenames and subdirectories.  To use TListBox you must create and
  745.      initialize a collection of PStrings containing the items to appear in the
  746.      list box, and then instantiate and initialize the list box.  While
  747.      TListBox is intended for use with string data, you can optionally override
  748.      TListBox.GetText to process non-string data.  TListBox is derived from
  749.      TListViewer, so all of TListViewer's methods and fields are available to
  750.      TListBox objects.
  751.      See:  TListViewer
  752.  
  753. Commonly Used Features
  754.      To use the TListBox, you'll call Init to create the box, and then NewList
  755.      to initialize the list that is displayed.  If you wish to display items
  756.      other than simple strings, you'll need to override GetText.
  757.  
  758. Example
  759.      TListBox is nearly identical to TListViewer except that TListBox does not
  760.      support the horizontal scroll bar.  Further, TListBox manages the data
  761.      list internally since its designed, by default to have GetText return a
  762.      string.  To use TListBox, you call TListBox.Init in a manner identical to
  763.      TListViewer.Init (except that there is no horizontal scroll bar).  Next,
  764.      you call TListBox.NewList to pass a collection of strings to the TListBox
  765.      for display.
  766.  
  767. Fields 
  768. List: PCollection; { Read only }
  769.      Holds a pointer to the collection of items to display.  Typically this
  770.      would be a collection of PStrings, however, if you store other object
  771.      types you will also need to override GetText.  
  772.      See: TListBox.GetText
  773.  
  774. Methods
  775. constructor Init(var Bounds: TRect; ANumCols: Word; AScrollBar: 
  776. PScrollBar );
  777.      Init creates the new TListBox object using the size provided in Bounds,
  778.      the number of columns specified by ANumCols, and links it to the scroll
  779.      bar passed as the AScrollBar parameter, or nil if there is no scroll bar. 
  780.      If you do add a scroll bar, you'll need to instantiate the TScroller
  781.      object prior to calling Init, and you'll need to insert both the list box
  782.      and the scroller into the owner's view.  After calling Init, you should
  783.      call NewList to assign the data collection to this list box.
  784.             There is no Done destructor for TListBox since it is inherited from
  785.      TListViewer.  However, you do need to dispose of the contents of List. 
  786.      Oneway to do that is to call NewList(nil) which then disposes of the
  787.      current List and sets List to nil.
  788.      See:  TListBox.NewList
  789.  
  790. function DataSize : Word; virtual;
  791. Override:  As needed.
  792.      This method is used in conjunction with the TListBox GetData and SetData
  793.      methods for writing and retrieving TListBox dialog data.  The default
  794.      definition of DataSize returns SizeOf(Pointer) + SizeOf(Word).
  795.      See:  GetData, SetData, "The List Box Viewer", in Chapter 12, "Turbo
  796.      Vision Dialogs and Events", in the Borland Pascal Developer's Guide.
  797.  
  798. procedure GetData(var Rec); virtual;
  799. Override: As needed.
  800.      GetData copies the List and Focused (from TListViewer) fields to Rec.
  801.      See:  DataSize, SetData, Chapter 12
  802.  
  803. function GetText(Item: Integer; MaxLen: Integer):String; virtual;
  804.      GetText is called by the inherited TListViewer.Draw method to obtain the
  805.      string to draw on the display.  The standard implementation retrieves the
  806.      Item'th entry in the List^ collection as,
  807.           PString(List^.At(Item))^
  808.      Its possible to store non-string items in a TListBox type, but to do so
  809.      you will need to override GetText.
  810.  
  811. constructor Load( var S: TStream );
  812.      Creates and reads a TListBox object from stream S, including the data
  813.      collection linked to the list box.
  814.      See:  Store, Chapter 16, "Collections".
  815.  
  816. procedure NewList(AList: PCollection); virtual;
  817.      After calling Init to create a new TListBox objecct, you need to link a
  818.      data collection to the list box.  You do this by passing the collection as
  819.      a parameter to the NewList method, which sets List to point to the
  820.      collection, and sets the list box Range to the collection's Count field
  821.      and draw's the list box view by calling DrawView.  If List is not nil when
  822.      NewList is called, NewList disposes of the previous collection before
  823.      setting List to the new collection.
  824.  
  825. procedure SetData(var Rec); virtual;
  826.      Copies values from Rec into the List and Focused fields and then calls
  827.      NewList(List) in order to reset and display the new list.
  828.      See:  DataSize, GetData
  829.  
  830. procedure Store(var S: TStream);
  831.      Stores the contents of the list box object, including the data collection
  832.      that is pointed to by List, to the stream S.
  833.      See:  Load, Chapter 15, "Streams".
  834.  
  835.  
  836. TListViewer object
  837. ------------------------------------------------------------ 
  838. Turbo Vision Hierarchy:
  839.   TObject
  840.      TView
  841.        TListViewer
  842.           TListBox
  843.  
  844. Discussion
  845.           Use the TListViewer object type for creating various types of list
  846.      box viewers.  List boxes typically contain lists of information, such as
  847.      filenames, through which you can scroll and select the desired item. 
  848.      Usingthe TListViewer object, you can create both vertical and horizontal
  849.      scroll bars.  Horizontal scroll bars might be used when creating a simple
  850.      file viewer for viewing text wider than the list box.
  851.  
  852. Commonly Used Features
  853.      Call TListViewer.Init to create the list viewer.  While the TListViewer
  854.      manages the display of the list box it is up to you to provide the data
  855.      structures that store the data shown within the box.  You do this by
  856.      deriving a new TListViewer object type and overriding the GetText
  857.      function, which returns a string containing one line of text.  GetText has
  858.      two paremeters, an item index and a maximum length value.  Its up to
  859.      GetText to retrieve the Item'th entry in the list and format it into a
  860.      string of no longer than the specified maximum length.  If you insert the
  861.      TListViewer into any other TGroup besides TDialog, you will almost
  862.      certainly need to override GetPalette so that the color mapping works
  863.      correctly.
  864.  
  865. Example
  866.   { Define TDirList, derived from TListViewer }
  867.   PDirViewer = ^TDirList;
  868.   TDirList = object( TListViewer );
  869.      function GetText( Item: Integer; MaxLen: Integer):String;
  870.           virtual;
  871.      function GetPalette: PPalette; virtual;
  872.      procedure HandleEvent( var Event: TEvent); virtual
  873.   end;
  874.   ...
  875.   { Instantiate a scroll bar object }
  876.   ListScroller := New( PScrollerBar, Init( BarBounds ));
  877.   { Instantiate a list viewer and link it to the scroll bar }
  878.   ListViewer := New( PDirViewer, Init( Bounds, 1, Nil,
  879.                    ListScroller ));
  880.   { Insert both objects into the controlling group view }
  881.   Insert(ListScroller);
  882.   Insert(ListViewer);
  883.  
  884. Fields
  885. HScrollBar: PScrollBar; { Read only }
  886.      Holds the pointer to the horizontal scroll bar object attached to this
  887.      list viewer, or is nil if there is no horizontal scroll bar.
  888.  
  889. VScrollBar: PScrollBar; { Read only }
  890.      Holds the pointer to the vertical scroll bar object attached to this list
  891.      viewer, or is nil if there is no vertical scroll bar.
  892.  
  893. NumCols : Integer { Read only }
  894.      This stores the number of columns specified for the list viewer and is
  895.      initialized with the Init constructor.
  896.  
  897. TopItem: Integer; { Read/Write }
  898.      TopItem specifies the item appearing at the top of the list box viewer. 
  899.      TopItem varies from 0 to Range-1.
  900.  
  901. Focused: Integer; { Read only }
  902.      Focused specifies the item number of the focused or selected item and
  903.      ranges from 0 to Range-1.  Keyboard navigation keys, scroll bar movements
  904.      and mouse clicks and drags all cause the focused item to be updated to
  905.      point to the current location of the list box cursor.
  906.  
  907. Range: Integer; { Read only }
  908.      Holds the total number of items in the list.
  909.      See:  TListViewer.SetRange
  910.  
  911. Methods
  912. constructor Init( var Bounds: TRect; ANumCols: Integer; AHScrollBar,
  913. AVScrollBar: PScrollBar );
  914.      Creates a TListViewer object with the size specified by Bounds and the
  915.      number of columns specified by ANumCols.  If you wish to have scroll bars,
  916.      create the TScroller objects before calling Init, and then pass pointers
  917.      to those scroll bars to the AHScrollBar and AVScrollBar parameters, for
  918.      horizontal or vertical scroll bars, respectively, to link them to the list
  919.      box.  Use a value of nil if one or both scroll bars is not defined for
  920.      this list box.
  921.  
  922. procedure ChangeBounds( var Bounds : TRect ); virtual;
  923.      Call ChangeBounds to resize the list box viewer to the size specified by
  924.      the Bounds parameter.
  925.  
  926. procedure Draw; virtual;
  927. Override: Never.
  928.      Draws the list viewer object by calling GetText for each of the objects
  929.      that could be shown on the screen.
  930.  
  931. procedure FocusItem ( Item : Integer ); virtual;
  932. Override: Never.
  933.      Use FocusItem to make a specific Item in the list box become the focused
  934.      item.  This method automatically causes the scroll bar to be adjusted
  935.      accordingly.
  936.  
  937. function GetPalette: PPalette; virtual;
  938. Override: As needed.
  939.      Returns a pointer to the color palette for TListViewer objects.  The
  940.      default palette, CListViewer is intended to map directly into a CDialog
  941.      palette.  If you insert the TListViewer object into a view other than the
  942.      TDialog, you must override the GetPalette function.
  943.      See:  CListViewer, CDialog, Chapter 19, More on Turbo Vision
  944.  
  945. function GetText (Item : Integer; MaxLen: Integer): String; virtual;
  946. Override:  Always
  947.      You must implement your own GetText method to return a string representing
  948.      the data that should appear in the list box at the Item'th position. Your
  949.      data can be stored in whatever internal representation is appropriate for
  950.      your application.  This might include a collection, an array of records, a
  951.      linked list, or a simple string array, as shown in this example code:
  952.             { Fetch data item from internal data structure }
  953.             StrBuffer := MyData[Item];
  954.             { Truncate data string if too long }
  955.             if  Length(StrBuffer) > MaxLen  then
  956.                    StrBuffer[0] := Chr( MaxLen);
  957.             GetText := StrBuffer;
  958.  
  959. function IsSelected (Item: Integer): Boolean; virtual;
  960.      Use IsSelected to check if a specific item is also the focused item. 
  961.      IsSelected returns True if the entry specified by Item is currently
  962.      selected, False otherwise.
  963.  
  964. procedure HandleEvent( var Event: TEvent ); virtual;
  965. Override: As needed.
  966.      Performs event processing for the TListViewer, including mouse navigation
  967.      and clicking in the list box to select an item, the use of the space bar
  968.      to perform keyboard selection, and all keyboard navigation keys (up and
  969.      down arrow, PgUp, PgDn, Home, End, etc).  Navigation events that move
  970.      through the list automatically cause the associated scroll bars to update
  971.      themselves.
  972.      See:  See Chapter 11, "Turbo Vision Tutorial" in the Borland Pascal
  973.      Developer's Guide for an example.
  974.  
  975. constructor Load( var S : TStream );
  976.      Loads a TListViewer object from stream S, and also loads any associated
  977.      scrollbars.
  978. procedure SelectItem( Item: Integer ); virtual;
  979.      This is intended to be used and overridden by descendants, to make the
  980.      Item'th entry in the list selected.  This routine is essentially
  981.      equivalent to TListViewer.FocusItem.
  982.  
  983. procedure SetRange( ARange : Integer );
  984.      Sets the Range field to ARange or the number of items in the list and
  985.      automatically adjusts the scroll bars, as needed.  If the new range would
  986.      put the current Focused item value out of range, then Focused is reset to
  987.      zero.
  988.      See:  TListViewer.Range
  989.  
  990. procedure SetState( AState: Word; Enable: Boolean); virtual;
  991.      Basically, this calls TView.SetState to set or reset the sfOptions bits in
  992.      the TView.State variable.
  993.      See:  sfOptions, TView.State
  994.  
  995. procedure Store( var S: TStream);
  996.      Stores this TListViewer object onto stream S, and stores any associated
  997.      scroll bars.
  998.  
  999.  
  1000.  
  1001. TMenuBar object
  1002. ------------------------------------------------------------ 
  1003. Turbo Vision Hierarchy
  1004.   TObject
  1005.      TView
  1006.        TMenuView
  1007.           TMenuBar
  1008.           TMenuBox
  1009.  
  1010. Discussion
  1011.      The TMenuBar object manages the menu bar across the top of the application
  1012.      screen.  Most applications merely call the TMenuBar.Init method with a
  1013.      series of nested NewMenu, NewSubMenu, NewLine and NewItem function calls
  1014.      to create an entire list of pull down menu items.  It's unlikely that you
  1015.      will use any other TMenuBar methods.
  1016.  
  1017. Example
  1018.   MenuBar := New(PMenuBar, Init(Bounds, NewMenu(
  1019.      NewSubMenu('~R~un', hcNoContext, NewMenu(
  1020.        NewItem('~R~un', '', 0, cmRunProgram, hcNoContext,
  1021.        NewItem('~E~dit', 'Alt-E', kbAltE, cmEdit, hcNoContext,
  1022.        NewItem('~V~iew', 'Alt-V', kbAltV, cmView, hcNoContext,
  1023.        NewItem('~U~se DOS','Alt-D', kbAltS, cmUseDOS,
  1024.             hcNoContext,
  1025.        NewItem('E~x~it', 'Alt-X', kbAltX, cmQuit, hcNoContext,
  1026.             nil)))))),
  1027.   ...
  1028.  
  1029. Fields
  1030.      None
  1031.  
  1032. Methods
  1033. procedure Draw; virtual;
  1034.      Draws the menu bar on the display and highlights the selected item.
  1035.  
  1036. procedure GetItemRect(Item: PMenuItem; var R: TRect); virtual;
  1037.      This internal method is used to determine if a mouse click occurred on a
  1038.      particular menu item.
  1039.  
  1040. constructor Init(var Bounds: TRect; AMenu: PMenu);
  1041.      Creates an initializes the menu bar.  See the example above, and also look
  1042.      at NewMenu, NewSubMenu, NewItem, and NewLine functions.
  1043.  
  1044.  
  1045.  
  1046. TMenuBox object
  1047. ------------------------------------------------------------ 
  1048. Turbo Vision Hierarchy
  1049.   TObject
  1050.      TView
  1051.        TMenuView
  1052.           TMenuBar
  1053.           TMenuBox
  1054.  
  1055. Discussion
  1056.      The TMenuBox object implements the menu box that drops down from the menu
  1057.      bar.  TMenuBox displays the contents of the pulldown menu and processes
  1058.      the keyboard and mouse inputs to make a selection.  
  1059.  
  1060. Commonly Used Features
  1061.      Most applications will never reference the TMenuBox object directly. 
  1062.      Instead, pulldown menus are created with the NewSubMenu function nested
  1063.      within the TMenuBar.Init constructor.  However, it is possible to use the
  1064.      TMenuBox as a standalone pulldown menu providing a group of items from
  1065.      which to select.  For instance, sometimes its not practical to display
  1066.      every option on one of the standard pulldown menus.  Instead, consider
  1067.      adding a submenu that gets displayed only when one of the standard
  1068.      pulldown options is selected or perhaps as the result of a button press in
  1069.      a dialog box.  The example code below shows how to create and execute a
  1070.      standalone pulldown menu, here emulating the Watches submenu from the
  1071.      Turbo Pascal IDE's Debug menu.
  1072.  
  1073. Example
  1074.      AMenuBox is a PView-type variable.  When passed to DeskTop^.ExecView(),
  1075.      the standalone menu is displayed at the location specified by Bounds. 
  1076.      Oncea selection is made from the menu, Command is set to the cmXXXX
  1077.      constant corresponding the selected item.
  1078.  
  1079.   Begin
  1080.      Bounds.Assign(10,5, 40,12 );
  1081.      AMenuBox := New(PMenuBox, Init( Bounds, NewMenu(
  1082.        NewItem('~A~dd Watch', 'Ctrl-F7', kbCtrlF7, cmAddWatch,
  1083.           hcNoContext,
  1084.        NewItem('~D~elete Watch', '', 0, cmDelWatch, hcNoContext,               
  1085.           NewItem('~E~dit Watch...', '', 0, cmEditWatch,
  1086.           hcNoContext,
  1087.        NewItem('~R~emove all Watches', '', 0, cmRemWatch,
  1088.           hcNoContext,
  1089.        nil))))),nil));
  1090.      Command := DeskTop^.ExecView(AMenuBox);
  1091.   End;
  1092.  
  1093. Fields
  1094.      None
  1095. Methods
  1096. procedure Draw; virtual;
  1097.      Displays the menu box and contents.
  1098.  
  1099. procedure GetItemRec(Item: PMenuItem, var R: TRect); virtual;
  1100.      GetItemRec is used internally determine if the particular Item was
  1101.      selected by a mouse click.
  1102.  
  1103. constructor Init(var Bounds: TRect; AMenu: PMenu; AParentMenu: PMenuView );
  1104.      Use Init to create a new TMenuBox object, where Bounds describes both the
  1105.      size and location of the menu box, and AMenu is normally constructed from
  1106.      a series of nest calls to NewMenu, NewItem and so on.  For standard
  1107.      pulldown menus, AParentMenu points to the menu bar, but for standalone
  1108.      menu boxes, this parameter can be set to nil.
  1109.  
  1110.  
  1111.  
  1112. TMenu type
  1113. ------------------------------------------------------------ 
  1114. Declaration:       TMenu = record
  1115.        Items : PMenuItem;
  1116.        Default : PMenuItem;
  1117.      end;
  1118.  
  1119. Unit:     Menus
  1120.  
  1121. Purpose:
  1122.      TMenu is used for building up menu bar and pulldown menu records and is
  1123.      created by the NewMenu function.  TMenu records are unlikely to be used
  1124.      except for creation and maintanance of the menu bar object.
  1125.  
  1126.  
  1127. TMenuItem type
  1128. ------------------------------------------------------------ 
  1129. Declaration:
  1130. { TMENUITM.PAS }
  1131.   PMenuItem = ^TMenuItem;
  1132.   TMenuItem = record
  1133.     Next: PMenuItem;
  1134.     Name: PString;
  1135.     Command: Word;
  1136.     Disabled: Boolean;
  1137.     KeyCode: Word;
  1138.     HelpCtx: Word;
  1139.     case Integer of
  1140.       0: (Param: PString);
  1141.       1: (SubMenu: PMenu);
  1142.   end;
  1143.  
  1144. Unit:     Menus
  1145. Purpose:  
  1146.      TMenuItem records are created using the NewItem, NewLine and NewSubMenu
  1147.      functions, and are used to store a list of TMenuItem records describing
  1148.      each menu item on a pulldown menu.  The various fields store the values
  1149.      passed to the NewItem or NewSubMenu functions as follows:
  1150.        Next points to the next item in the menu structure, or is nil if it is
  1151.        the last item in the menu.  
  1152.        Name is a PString pointer to the item name, or nil in the case of a
  1153.        NewLine.
  1154.        Command contains the cmXXXX constant value used as an evCommand message
  1155.        to your view's HandleEvent procedure when the item is selected from the
  1156.        menu.
  1157.        Disabled is False normally, but set to True if the item has been
  1158.        disabled.
  1159.        KeyCode contains the hot key's scan code, if any, or zero if there is
  1160.        not hot key defined for this item.
  1161.        HelpCtx contains the help constant identifier for use in an on-line help
  1162.        system.
  1163.        The last variant field contains either Param, a pointer to the text
  1164.        displayed next to a menu item, normally the hot key prompt, such as
  1165.        'Alt-A' (or nil if there is no parameter string), or SubMenu as a
  1166.        pointer to the submenu structure.
  1167.        See: Chapter 11, "Turbo Vision Tutorial", NewItem, NewLine, NewSubMenu,
  1168.        TMenu.
  1169.  
  1170.  
  1171. TMenuStr type
  1172. ------------------------------------------------------------ 
  1173. Declaration:       
  1174.   TMenuStr = String[31];
  1175.  
  1176. Unit:     Menus
  1177.  
  1178. Purpose:
  1179.      TMenuStr defines the string type used for storing menu item names, and
  1180.      limits menu names and item names to a maximum of 31 characters in length.
  1181. See: NewItem, NewSubMenu
  1182.  
  1183.  
  1184.  
  1185. TMenuView object
  1186. ------------------------------------------------------------ 
  1187. Turbo Vision Hierarchy
  1188.   TMenuView
  1189.      TView
  1190.        TMenuView
  1191.           TMenuBar
  1192.           TMenuBox
  1193.  
  1194. Discussion
  1195.      TMenuView implements much of the functionality for TMenuBar and TMenuBox
  1196.      and is not used directly.  Refer to TMenuBar and TMenuBox for examples of
  1197.      the menu facilities.  Most of the methods shown below are used internally
  1198.      by the derived object types and rarely used in a typical application.
  1199.  
  1200. Fields
  1201. ParentMenu: PMenuView; { Read only }
  1202.      Points to the TMenuView-type object that owns this menu object.
  1203.  
  1204. Menu: PMenu; { Read only }
  1205.      Points to a TMenu-type record, which in turn points to a linked list of
  1206.      TMenuItem records defining each of the menu items that appear on the menu.
  1207.      See:  TMenu type, TMenuItem type
  1208.  
  1209. Current: PMenuItem; { Read only }
  1210.      Keeps track of which menu item is the currently selected one.
  1211.  
  1212. Methods
  1213. function Execute: Word; virtual;
  1214. Override:  Never
  1215.      ExecView calls Execute to process the modal nature of the pulldown menu. 
  1216.      Execute returns cmXXXX constant that was defined for the menu selection,
  1217.      or 0 if the Esc key was pressed and nor selection was made.
  1218.  
  1219. function FindItem(Ch: Char); PMenuItem;
  1220.      FindItem scans through the menu box structure looking for a menu item that
  1221.      has Ch has its shortcut key, and returns a pointer to that menu item, or
  1222.      nil if not matches were found.
  1223.  
  1224. procedure GetItemRect(Item: PMenuItem; var R: TRect); virtual;
  1225.      This internal method helps the menu code determine which menu item on
  1226.      which a mouse click occurred. 
  1227.  
  1228. function GetHelpCtx: Word; virtual;
  1229.      Returns the value of the help context constant for the current menu item. 
  1230.      If the menu item's help context is hcNoContext, then GetHelpCtx checks the
  1231.      owner of the menu and return's its help context.
  1232.  
  1233. function GetPalette: PPalette; virtual;
  1234.      Returns a pointer to CMenuView, the default color palette for menus.
  1235.      See:  CMenuView
  1236.  
  1237. procedure HandleEvent(var Event: TEvent); virtual;
  1238. Override: Never.
  1239.      Process all events for the menu object.
  1240.  
  1241. function HotKey(KeyCode: Word): PMenuItem;
  1242.      Scans through the menu structure looking for the menu item that has the
  1243.      hot key specified by KeyCode defined, and if found, returns a pointer to
  1244.      that menu item.  Otherwise, if KeyCode is not found, then it returns nil.
  1245.  
  1246. constructor Init(var Bounds: TRect);
  1247.      Creates a view having the indicated Bounds.  TMenuView.Init should only be
  1248.      called by TMenuBar and TMenuBox.
  1249.  
  1250. constructor Load(var S: TStream);
  1251.      Creates and loads a TMenuView object from stream S.
  1252.  
  1253. procedure Store(var S: TStream);
  1254.      Writes the TMenuView object to stream S.
  1255.  
  1256.  
  1257.  
  1258. TObject object
  1259. ------------------------------------------------------------ 
  1260. Turbo Vision Hierarchy
  1261.   TObject
  1262.      TView
  1263.      TCollection
  1264.      TStream
  1265.      TStringList
  1266.      TStrListMaker
  1267.      TResourceFile
  1268.  
  1269. Discussion
  1270.      Nearly all objects used in Turbo Vision are defined from this root object
  1271.      type, and all objects written to streams must be descended from TObject.
  1272.  
  1273. Fields
  1274.      None
  1275.  
  1276. Methods
  1277. destructor Done;
  1278.      Disposes a dynamically allocated object.
  1279.  
  1280. procedure Free;
  1281.      Descendants of TObject actually call TObject.Free to dispose of the
  1282.      dynamically allocated object.
  1283.  
  1284. constructor Init;
  1285.      TObject.Init is called from all descended object's Init constructors. 
  1286.      Descendant's should always call their parent's Init method prior to
  1287.      performing their own initialization since TObject carefully zeroes all
  1288.      allocated fields as part of its initialization.
  1289.  
  1290.  
  1291.  
  1292. TPalette type
  1293. ------------------------------------------------------------ 
  1294. Declaration:       
  1295.   TPalette = String;
  1296.  
  1297. Unit:     Views
  1298.  
  1299. Purpose:
  1300.      Defines the data type used for storing color palettes.  Since all color
  1301.      palettes are equivalent to strings, you can use, if you wish, all of the
  1302.      various string manipulation functions, including indexing, Copy, Delete,
  1303.      Insert and so on.
  1304.      See:  Chapter 13, "More Turbo Vision Features"
  1305.  
  1306.  
  1307.  
  1308. TParamText object
  1309. ------------------------------------------------------------ 
  1310. Turbo Vision Hierarchy
  1311.   TObject
  1312.      TView
  1313.        TStaticText
  1314.           TLabel
  1315.           TParamText
  1316.  
  1317. Discussion
  1318.      TParamText is essentially equivalent to TStaticText, for displaying text
  1319.      strings in dialog boxes except that TParamText provides enhanced
  1320.      flexibility in the formatting of the text strings.  The string parameter
  1321.      passed to TParamText.Init may contain embedded formatting information and
  1322.      is passed directly to the FormatStr procedure.
  1323.      See:  FormatStr, TStaticText, TLabel, TDialog
  1324.  
  1325. Commonly Used Features
  1326.      If you use this object type, you will probably create the object with the
  1327.      Init constructor and then insert it into a dialog and are unlikely to
  1328.      directly access the other methods.  You will need to directly assign a
  1329.      value to the ParamList pointer as shown in the example.
  1330.  
  1331. Example
  1332.      This example of TParamText shows how a variable FileName might be inserted
  1333.      into a TParamText derived object, AParam.  Each time that the dialog is
  1334.      displayed, or particularly if the dialog is normally stored in a resource
  1335.      file, the FileName parameter can be automatically inserted into the
  1336.      TParamText message prompt by changing Parameters.AParamStr to a new value.
  1337.   var
  1338.      AParam : PParamText;
  1339.      Parameters : record
  1340.        AParamStr : PString;
  1341.      end;
  1342.   ...
  1343.   { Set up the contents of the Delete dialog }
  1344.   with  Dialog^  do
  1345.   begin
  1346.       ...
  1347.      { Add the Delete Okay? }
  1348.      Bounds.Assign ( 8, 2, 45, 3 );
  1349.      AParam := New (PParamText,
  1350.      Init( Bounds, 'Okay to Delete %s', 1 ));
  1351.      Parameters.AParamStr := NewStr(FileName);
  1352.      AParam^.ParamList := @Parameters;
  1353.      Insert( AParam );
  1354.   end; { with }
  1355.  
  1356.   Control := DeskTop^.ExecView (Dialog);
  1357.  
  1358.  
  1359. Fields
  1360. ParamCount: Integer;
  1361.      Specifies the number of parameters in the ParamList^ parameter array or
  1362.      record.
  1363.  
  1364. ParamList: Pointer;
  1365.      Points to the parameter array or parameter record that specifies the data
  1366.      values to be inserted into the Text string (which is inherited from
  1367.      TStaticText).  See FormatStr for a complete description of string
  1368.      formatting.
  1369.  
  1370. Methods
  1371. function DataSize: Word; virtual;
  1372.      Used in conjunction with GetData and SetData, DataSize returns the size in
  1373.      bytes of  the data storage used by a TParamCount object.
  1374.  
  1375. procedure GetText(var S: String); virtual;
  1376.      Calls FormatStr( S, Text^, ParamList^ ) to format and merge the parameters
  1377.      in TParamText.ParamList^ with the TParamText.Text^ string (Text is a field
  1378.      inherited from TStaticText to hold the contents of this item's text) and
  1379.      produces the resultant output string S.
  1380.      See:  FormatStr, TParamText.ParamList, TParamText.Text, TStaticText.Text
  1381.  
  1382. constructor Init(var Bounds: TRect; AText: String; AParamCount: Integer);
  1383.      TParamText.Init calls TStaticText.Init to create the object, and then
  1384.      stores AParamCount into TParamText.ParamCount.  AText is the text to be
  1385.      used for the message prompt.   You must separately assign the parameter
  1386.      array or record to ParamList.
  1387.  
  1388. constructor Load(var S: TStream);
  1389.      Creates and reads a TParamText object from stream S.
  1390.  
  1391. procedure SetData(var Rec); virtual;
  1392.      Copies the number of bytes specified by DataSize into Rec.
  1393.  
  1394. procedure Store(var S: TStream);
  1395.      Writes the TParamText object to stream S.
  1396.  
  1397.  
  1398.  
  1399. TPoint object
  1400. ------------------------------------------------------------ 
  1401. Turbo Vision Hierarchy
  1402.  
  1403. Fields
  1404. X: Integer;
  1405. Y: Integer;
  1406.      Defines a point (X,Y) on the screen.
  1407.  
  1408.  
  1409.  
  1410. TProgram object
  1411. ------------------------------------------------------------ 
  1412. Turbo Vision Hierarchy
  1413.   TObject
  1414.      TView
  1415.        TGroup
  1416.           TProgram
  1417.           TApplication
  1418.  
  1419. Discussion
  1420.      TProgram contains most of the functionality present in TApplication. 
  1421.      Usually you will derive your application directly from TApplication but it
  1422.      is possible to derive it from TProgram instead.  All Turbo Vision programs
  1423.      must be derived from either TApplication (preferred) or TProgram.
  1424.  
  1425. Commonly Used Features
  1426.      The following are the frequently used methods of TProgram:  Init, Done,
  1427.      HandleEvent, Idle, InitMenuBar, InitStatusLine, OutOfMemory, Run,
  1428.      SetScreenMode
  1429.  
  1430. Example
  1431.      See TVSHELL8 in the Borland Pascal Developer's Guide for a complete
  1432.      example of a finished application using the frequently used methods of
  1433.      TProgram (except Idle).
  1434.  
  1435. Fields
  1436.      None
  1437.  
  1438. Methods
  1439. destructor Done;
  1440.      TProgram.Done disposes of all the application related objects, including
  1441.      StatusLine, MenuBar and DeskTop and essentially terminates the Turbo
  1442.      Vision program.
  1443.  
  1444. procedure GetEvent(var Event: TEvent); virtual;
  1445.      This is the application's event processing loop.  GetEvent checks for
  1446.      mouse and keyboard events and since TProgram owns all of the application's
  1447.      views, GetEvent sends the event record to the appropriate view for
  1448.      processing.  If no events occurred, then GetEvent calls TProgram.Idle (see
  1449.      TProgram.Idle).
  1450.  
  1451. function GetPalette: PPalette; virtual;
  1452.      Returns a pointer to the default color palette for the application.  Since
  1453.      TProgram.GetPalette points to the application level palette, of which
  1454.      there are 3, CColor, CBlackWhite and CMonochrome, GetPalette checks the
  1455.      AppPalette variable to determine which application palette is the
  1456.      currently active palette.
  1457.      See:  appPalette, apXXXX constants, CBlackWhite, CColor, CMonochrome
  1458.  
  1459. procedure HandleEvent(var Event: TEvent); virtual;
  1460. Override:  Always, to implement an application's functions.
  1461.      Every application will override HandleEvent (but don't forget to call
  1462.      TProgram.HandleEvent first), to process the cmXXXX commands returned by
  1463.      the various menu selections and short cut keys.
  1464.      See:  Chapter 11, "Turbo Vision Tutorial", and TVSHELL8 for examples.
  1465.  
  1466. procedure Idle; virtual;
  1467.      You can have your Turbo Vision application perform background tasks during
  1468.      idle periods in the program's execution.  To make use of idle time,
  1469.      override TProgram.Idle to perform your background tasks (always remember
  1470.      to call TProgram.Idle as the first statement within your overwritten Idle
  1471.      procedure).  TProgram.Idle should only perform operations that can be done
  1472.      quickly as Idle is called from within TProgram's GetEvent loop.  This
  1473.      means that if TProgram.Idle takes a lengthy time to complete operation,
  1474.      your program's execution appear to be slow down to unacceptable levels.
  1475.  
  1476. constructor Init;
  1477.      Initialize's Turbo Vision support for an application, including the video
  1478.      screen modes, and calls InitDeskTop, InitStatusLine and InitMenuBar.  You
  1479.      must override the last three methods to provide your application's status
  1480.      line and menu bar definitions.
  1481.  
  1482. procedure InitDeskTop; virtual;
  1483.      Initializes an application's TDeskTop object and sets the global DeskTop
  1484.      pointer to point to this object.  See the listing given in TBackground for
  1485.      an example of how this method can be overriden to create a TDeskTop object
  1486.      other than the default desktop.
  1487.  
  1488. procedure InitMenuBar; virtual;
  1489.      You should always override InitMenuBar so that it creates a new menu bar
  1490.      and associated pulldown menus and setsMenuBar to point to the new menu
  1491.      structure.   See Chapter 11.
  1492.  
  1493. procedure InitScreen; virtual;
  1494.      This internal routine is called by TProgram.SetScreenMode to initialize
  1495.      all of the Turbo Vision screen mode dependant values:  ShadowSize,
  1496.      AppPalette and ShowMarker.
  1497.  
  1498. procedure InitStatusLine; virtual;
  1499.      You should always override InitStatusLine so that it creates a new
  1500.      statusline and set the global variable StatusLine to point to the new
  1501.      status line structure.  See Chapter 11.
  1502.  
  1503. procedure OutOfMemory; virtual;
  1504.      Whenever TProgram.ValidView finds that LowMemory is True, meaning that the
  1505.      low memory buffer area has been entered, TProgram.ValidView calls
  1506.      OutOfMemory.  You should override this procedure to display an error or
  1507.      warning message to the user with information about the low memory problem.
  1508.      See:  LowMemory, TProgram.ValidView
  1509.  
  1510. procedure PutEvent(var Event: TEvent); virtual;
  1511.      PutEvent inserts Event into the pending Event queue so that the next call
  1512.      to GetEvent returns Event. 
  1513.  
  1514. procedure Run; virtual;
  1515.      Calls the inherited TGroup.Execute method, which is the main event loop of
  1516.      the application.
  1517.  
  1518. procedure SetScreenMode( Mode: Word );
  1519.      When you need to switch between the 3 application level color palettes,
  1520.      CColor, CBlackWhite or CMonochrome, or switch between 25- and 43/50-line
  1521.      screen modes, call TProgram.SetScreenMode, setting the Mode parameter with
  1522.      the values smCO80, smBW80 or smMono, OR'd, as needed, with smFont8x8.  See
  1523.      the procedure SetVideoMode for complete details; normally you will call
  1524.      TProgram.SetScreenMode rather than SetVideoMode.
  1525.  
  1526. function TProgram.ValidView(P: PView): PView;
  1527.      ValidView is used to determine if a newly constructed view was created
  1528.      appropriately.  It does this by checking the LowMemory flag and if True,
  1529.      automatically calls TProgram.OutOfMemory.  ValidView also insures that P
  1530.      is not nil, and if any errors are founds, ValidView returns a nil pointer.
  1531.      You can use ValidView to check the instantiation of new views directly as
  1532.      they are inserted into a group.  
  1533.           DeskTop^.Insert(ValidView( New( PStaticText, Init( ... ) ) ) );
  1534.      This results in an automatic error handling sequence, calling OutOfMemory
  1535.      or what not, as Insert will ignore a nil pointer and will not insert the
  1536.      failed view.
  1537.      See:  TProgram.OutOfMemory, TView.Valid, TGroup.Valid, Chapter 13, "More
  1538.      Turbo Vision Features".
  1539.  
  1540.  
  1541.  
  1542. TRadioButtons object
  1543. ------------------------------------------------------------ 
  1544. Turbo Vision Hierarchy
  1545.   TObject
  1546.      TView
  1547.        TCluster
  1548.           TRadioButtons
  1549.           TCheckBoxes
  1550.  
  1551. Discussion
  1552.      Use TRadioButtons to implement groups of radio buttons in dialog boxes. 
  1553.      Chapter 11 in the Borland Pascal Developer's Guide contains a tutorial on
  1554.      the creation and use of TRadioButtons objects.
  1555.      See TCheckBoxes, TDialogs
  1556.  
  1557. Commonly Used Features
  1558.      Most applications will use the inherited TCluster.Init method to
  1559.      initialize a radio button group, and then Insert the group into the
  1560.      dialog.  There is little need to use any of the other available methods
  1561.      directly.
  1562.  
  1563. Example
  1564.      This example shows creating and inserting a radio button into an owner,
  1565.      which is normally a TDialog object, and linking it to a TLabel prompt
  1566.      line:
  1567.  
  1568.   Bounds.Assign(3, 2, 20, 4);
  1569.   VideoOptions := New (PRadioButtons, Init (Bounds,
  1570.                    NewSItem('~2~5 lines',
  1571.                    NewSItem('~4~3/50 lines',
  1572.                    nil))
  1573.                    ));
  1574.   Insert(VideoOptions);
  1575.   Bounds.Assign( 3, 1, 20, 2);
  1576.   Insert( New( PLabel, Init( Bounds, 'Screen size', VideoOptions)));
  1577.  
  1578. Fields
  1579.      None
  1580.  
  1581. Methods
  1582. procedure Draw; virtual;
  1583.      Displays each radio button, including the "( )" selection fields.
  1584.  
  1585. function Mark(Item: Integer): Boolean; virtual;
  1586.      Use Mark to determine if a specific radio button, specified by Item, is
  1587.      currently pressed.
  1588.  
  1589. procedure MovedTo(Item: Integer); virtual;
  1590.      MovedTo is identical to Press and sets the Item'th radio button to
  1591.      "pressed".
  1592.  
  1593. procedure Press(Item: Integer); virtual;
  1594.      Makes the Item'th radio button the currently pressed radio button.
  1595.  
  1596. procedure SetData(var Rec); virtual;
  1597.      Copies the Value and Sel fields from Rec, and then sets the selected item
  1598.      indicated by Sel to the "pressed" state.
  1599.  
  1600.  
  1601.  
  1602. TRect object
  1603. ------------------------------------------------------------ 
  1604. Turbo Vision Hierarchy
  1605.      TRect is a standalone object.
  1606.  
  1607. Discussion
  1608.      TRect primarly defines two coordinates, A and B, which are the upper left
  1609.      and the lower right corners of a rectangle.  TRect parameters are used
  1610.      throughout Turbo Vision to specify the screen location and size of
  1611.      windows, dialog boxes and entry fields.
  1612.  
  1613. Commonly Used Features
  1614.      The mostly commonly used method is Assign, used to initialize the
  1615.      coordinate values, but several utility methods also enable quick changes
  1616.      in the values of the coordinate fields and making copies of the TRect
  1617.      object.
  1618.  
  1619. Example
  1620.   var
  1621.      Bounds:  TRect;
  1622.      ARectangle : TRect;
  1623.   ...
  1624.   { Initialize to the coordinates (0,0) and (80,2) }
  1625.   Bounds.Assign(0, 0, 80, 2);
  1626.   ...
  1627.   { Copy the contents of Bounds to ARectangle }
  1628.   ARectangle.Copy( Bounds );
  1629.  
  1630. Fields
  1631. A: TPoint;
  1632.      A TPoint defining the upper left corner of a rectangle.
  1633.  
  1634. B: TPoint;
  1635.      A TPoint defining the lower right corner of a rectangle.
  1636.  
  1637. Methods
  1638. procedure Assign( XA, YA, XB, YB: Integer);
  1639.      Sets A.X := XA, A.Y := YA, B.X := XB and B.Y := YB.
  1640.  
  1641. procedure Copy(R: TRect);
  1642.      Sets the A and B fields to the values in R.
  1643.  
  1644. procedure Move(ADX, ADY: Integer);
  1645.      Adds ADX to the X values and ADY to the Y values of A and B.
  1646.      Sets A.X := A.X + ADX, B.X := B.X + ADX and sets A.Y := A.Y + ADY, B.Y :=
  1647.      B.Y + ADY.
  1648.  
  1649. procedure Grow(ADX, ADY: Integer);
  1650.      Adjusts A and B as follows:
  1651.      A.X := A.X - ADX;           B.X := B.X + ADX;
  1652.      A.Y := A.Y- ADY;            B.Y := B.Y + ADY;
  1653.  
  1654. procedure Intersect(R: TRect);
  1655.      Determines the area that this rectangle overlaps with the rectangle
  1656.      specified by R, and sets A and B to the intersection of the two
  1657.      rectangles.
  1658.  
  1659. procedure Union(R: TRect);
  1660.      Creates a new rectangle that encompasses A and B and the rectangle R.
  1661.  
  1662. function Contains(P: TPoint): Boolean;
  1663.      Returns True if P lies within the rectangle specified by A and B.
  1664.  
  1665. function Equals(R: TRect): Boolean;
  1666.      Compares A and B to R, and returns True if they are equal, and False if
  1667.      they are not.
  1668.  
  1669. function Empty: Boolean;
  1670.      If A and B are equal, then A and B describe a rectangle containing no
  1671.      spaces.  Empty returns True if A = B.
  1672.  
  1673.  
  1674.  
  1675. TResourceFile object
  1676. ------------------------------------------------------------ 
  1677. Turbo Vision Hierarchy
  1678.   TObject
  1679.      TResourceFile
  1680.  
  1681. Discussion
  1682.      TResourceFile is a special purpose random access TStream that let's you
  1683.      find records by a key string instead of a record number.  Using
  1684.      TResourceFile, you can implement simple data base retrievals, as well as
  1685.      store Turbo Vision components.
  1686.      See  Chapter 16, "Resources" in the Borland Pascal Developer's Guide for a
  1687.      complete discussion and tutorial on the use of TResourceFile objects.
  1688.  
  1689. Commonly Used Features
  1690.      In addition to Init, Put, Get and Done are the most frequently used
  1691.      methods of the TResourceFile object.
  1692.  
  1693. Fields
  1694. Stream: PStream;
  1695.      Points to the stream used by this TResourceFile object.
  1696.  
  1697. Modified: Boolean;
  1698.      If the file has been modified, then this flag is set to True.  The
  1699.      TResourceFile.Flush procedure checks this flag to determine if it should
  1700.      update the resourc file.
  1701.  
  1702. Methods
  1703. function Count: Integer;
  1704.      Computes and returns the number of items or resources stored in the file.
  1705.  
  1706. procedure Delete(Key: String);
  1707.      Removes the key from the index and marks the space it previously occuppied
  1708.      as being deleted.  
  1709.      See TResourceFile.SwitchTo for a method to reclaim the now unused space.
  1710.  
  1711. destructor Done; virtual;
  1712.      Calls TResourceFile.Flush and disposes of the index collection and
  1713.      resource stream file.
  1714.  
  1715. procedure Flush;
  1716.      Checks the Modified flag, and if True, updates the resource stream file,
  1717.      and then resets Modified to False.
  1718.  
  1719. function Get(Key: String); PObject;
  1720.      Uses Key as an index into the resource and returns a pointer to the object
  1721.      that it references, or nil if the Key is not in the file.
  1722.      See TResourceFile.Put
  1723.  
  1724. constructor Init( AStream: PStream );
  1725.      TResourceFile.Init is called after opening a stream.  The opened stream is
  1726.      passed as a parameter to Init and becomes the stream that holds the
  1727.      resource file.  See Chapter 16, "Resources".
  1728.  
  1729. function KeyAt(I: Integer): String;
  1730.      Use KeyAt to scan through the entire resource file.  I is an index to each
  1731.      resource in the file, numbered 0 to TResourceFile.Count minus 1.  KeyAt
  1732.      returns the string corresponding to the key value at the I'th index
  1733.      position.
  1734.  
  1735. procedure Put(Item: PObject; Key: String);
  1736.      Stores the object pointed to by Item into the resource file, using the
  1737.      specified Key.
  1738.      See TResourceFile.Get
  1739.  
  1740. function SwitchTo(AStream: PStream; Pack: Boolean): PStream;
  1741.      Use SwitchTo to copy the current resource file to another stream specified
  1742.      by AStream.  If Pack is True, SwitchTo will not copy objects marked as
  1743.      deleted, thereby compressing the resulting resource file.
  1744.      See:  TResourceFile.Delete
  1745.  
  1746.  
  1747.